package cz.muni.fi.pa165.sme.dao.api;

import java.util.List;

import cz.muni.fi.pa165.sme.dao.entity.SportActivity;
import cz.muni.fi.pa165.sme.dao.entity.SportActivityRecord;
import cz.muni.fi.pa165.sme.dao.entity.User;
import cz.muni.fi.pa165.sme.dao.exception.ReferenceIntegrityException;

/**
 * An interface for management of {@link SportActivityRecord} entities in a storage.
 *
 * @author jirankova
 */
public interface SportActivityRecordDao {

	/**
	 * Adds a new {@link SportActivityRecord} to a storage, creates its ID. Object's ID must be null.
	 *
	 * @param sportActivityRecord {@link SportActivityRecord} to be created.
	 */
	void createSportActivityRecord(final SportActivityRecord sportActivityRecord);

	/**
	 * Removes a {@link SportActivityRecord} object from a storage. Object's ID must not be null.
	 *
	 * @param sportActivityRecord {@link SportActivityRecord} to be removed.
	 * @throws ReferenceIntegrityException if the requested object is referenced in the storage.
	 */
	void deleteSportActivityRecord(final SportActivityRecord sportActivityRecord);

	/**
	 * Updates a {@link SportActivityRecord} object as requested. Object's ID must not be null; parameters can be
	 * changed to null where applicable.
	 *
	 * @param sportActivityRecord {@link SportActivityRecord} to be updated
	 */
	void updateSportActivityRecord(final SportActivityRecord sportActivityRecord);

	/**
	 * Finds a {@link SportActivityRecord} object by its ID.
	 *
	 * @param id ID to be looked up in the storage
	 * @return {@link SportActivityRecord} with the provided ID, or null if none found
	 */
	SportActivityRecord findSportActivityRecordById(final Long id);

	/**
	 * Finds all {@link SportActivityRecord}s related to the provided {@link User}.
	 *
	 * @param user {@link User} object to get the data for; must not be null
	 * @return list of all related {@link SportActivityRecord}s; never null.
	 */
	List<SportActivityRecord> findAllSportActivityRecordsByUser(final User user);

	/**
	 * Finds all {@link SportActivityRecord}s related to the provided {@link SportActivity}.
	 *
	 * @param sportActivity {@link SportActivity} object to get the data for; must not be null
	 * @return list of all related {@link SportActivityRecord}s; never null
	 */
	List<SportActivityRecord> findAllSportActivityRecordsBySportActivity(final SportActivity sportActivity);

	/**
	 * Returns all {@link SportActivityRecord}s from the storage.
	 *
	 * @return list of all {@link SportActivityRecord}s; never null.
	 */
	List<SportActivityRecord> findAllSportActivityRecords();
}
